package com.zbcx.generate.mbtiles.db;

import java.sql.Connection;


public class TransactionManager {
	/**
	 * 事务开始
	 * 
	 * @throws Exception
	 */
	public static void beginTransaction() throws Exception {
		Connection conn = DBUtils.getCurrentConnection();
		conn.setAutoCommit(false);
	}
	
	/**
	 * 事务回滚
	 * 
	 * @throws Exception
	 */
	public static void rollback() throws Exception {
		Connection conn = DBUtils.getCurrentConnection();
		conn.rollback();
		DBUtils.closeConnection();
	}

	/**
	 * 提交事务
	 * 
	 * @throws Exception
	 */
	public static void commit() throws Exception {
		Connection conn = DBUtils.getCurrentConnection();
		conn.commit();
	}
}
